<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>城配附加信息页面</title>
    <style type="text/css">
        .searchArea .fieldBox .label{width: 70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
            <div class="clearFix"></div>
            <div class="btnsBox formBtns notRight">
            	<%-- <c:if test="${spFlag!=1 && dyFlag!=1 }">
	                <span id="exportbtn" class="sq-button-round" onclick="toPrjFileInfo();">项目资料</span>
            	</c:if> --%>
                <%-- <c:if test="${isCPCW==1}">
		        	<span id="hexiaoOpn" class="sq-button sq-button-round" onclick="kjhexiaoshouqi();">维护首期款核销资金信息</span>
		    	</c:if> --%>
            </div>
        </div>
    </form>
</div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
var grid = null;
var prjId = '${prjId}';
var checkSp = '${checkSp}';
var checkDy = '${checkDy}';
var confirmPay = '${confirmPay}';
$(function () {
    grid = $("#ligergrid1").ligerGrid({
        url: '<%=path%>/capital/capPayInfo/initList.do?isCpFlow=1&payTypCd=2&prjId='+prjId,
        method: 'get',
        columns: [
            {display: '客户名称', name: 'cstNm', width: 100, enabledSort: false},
            {display: '合同号', name: 'contNo', width: 120, align: 'left', enabledSort: false},
            {display: '支付表号', name: 'paySchNo', width: 150, align: 'left', enabledSort: false},
            {display: '放款金额', name: 'payAmt', width: 80, align: 'right', enabledSort: false,
                render:function(rowdata,index,value){
                    return '&yen;'+FormatMoney(rowdata.payAmt/100);
                }
            },
            {display: '实际放款金额', name: 'actPayAmt', width: 100, align: 'right', enabledSort: false,
                render:function(rowdata,index,value){
                    if(rowdata.actPayAmt){
                        return '&yen;'+FormatMoney(rowdata.actPayAmt/100);
                    }
                }
            },
            {display: '实际付款时间', name: 'actPayTm', width: 100, align: 'left', enabledSort: false,render:renderDate},
            /* {display: '首期款代收', name: 'isFstColNm', width: 80, align: 'center', enabledSort: false}, */
            {display: '放款状态', name: 'payStsCdNm', width: 80, align: 'center', enabledSort: false},
            {display: '项目类型', name: 'prjTypCdNm', width: 100, align: 'center', enabledSort: false},
            {display: '客户经理', name: 'cstMgrNm', width: 80, align: 'center', enabledSort: false},
            /* {display: '所属事业部', name: 'buOrgCdNm', width: 100, align: 'center', enabledSort: false}, */
            { 
	         	display: '操作',minWidth: 150,align:'left',
	         	render: function (rowdata, rowindex, value){
	         		var h='<a class="sq-button-hasicon" href="javascript:toPayFlowAdditionalPage(';
	              	    h+="'"+rowdata.id+"'";
		              	h+=')"><i class="sqBtnIco_6"></i>审核</a>';
	              return h;
	         	}
            }
        ],
        pageSize: 100,
        root: 'rows',
        record: 'total',
        hideLoadButton: true,
        width: '100%',
        height: '100%',
        heightDiff: -2,
        checkbox: false,
        rownumbers: true,
        allowUnSelectRow: true,
        alternatingRow: true
    });
    grid.setHeight(100);
});

/**新增上牌信息*/
function addSp(_prjPrdDtlId){
	if(!_prjPrdDtlId)return;
	var detailFlag = false;
	//调上牌维护页面 传递是否流程标识(isFlow=1)  是的话 页面执行
	Add_navTab( 'sp_info_add','添加上牌信息','<%=path%>/project/prjprdlicinfo/toAddPage.do?isFlow=1&detailFlag='+detailFlag+'&dtlId='+_prjPrdDtlId,callback);
}
/**修改上牌信息*/
function modifySp(_prjPrdDtlId){
	if(!_prjPrdDtlId)return;
	var detailFlag = false;
	//调上牌维护页面 传递是否流程标识(isFlow=1)  是的话 页面执行
	Add_navTab( 'sp_info_add','修改上牌信息','<%=path%>/project/prjprdlicinfo/toAddPage.do?isFlow=1&detailFlag='+detailFlag+'&dtlId='+_prjPrdDtlId+'&id='+_prjPrdDtlId,callback);
}
/**查看上牌信息*/
function showSp(_prjPrdDtlId){
	var detailFlag = true;
	//调上牌维护页面 传递是否流程标识(isFlow=1)  是的话 页面执行
	Add_navTab( 'sp_info_add','查看上牌信息','<%=path%>/project/prjprdlicinfo/toAddPage.do?isFlow=1&checkSp=${checkSp}&detailFlag='+detailFlag+'&dtlId='+_prjPrdDtlId+'&id='+_prjPrdDtlId, callback);
}
/**新增抵押信息*/
function addDy(_prjPrdDtlId){
	if(!_prjPrdDtlId)return;
	var detailFlag = false;
	//调抵押维护页面 传递是否流程标识(isFlow=1)  是的话 页面执行
	Add_navTab( 'dy_info_add','添加抵押信息','<%=path%>/project/prjprdmtg/toAddPage.do?isFlow=1&detailFlag='+detailFlag+'&dtlId='+_prjPrdDtlId,callback);
}
/**修改抵押信息*/
function modifyDy(_prjPrdDtlId){
	if(!_prjPrdDtlId)return;
	var detailFlag = false;
	//调抵押维护页面 传递是否流程标识(isFlow=1)  是的话 页面执行
	Add_navTab( 'dy_info_add','修改抵押信息','<%=path%>/project/prjprdmtg/toAddPage.do?isFlow=1&detailFlag='+detailFlag+'&dtlId='+_prjPrdDtlId+'&id='+_prjPrdDtlId,callback);
}
/**查看抵押信息*/
function showDy(_prjPrdDtlId){
	var detailFlag = true;
	//调抵押维护页面 传递是否流程标识(isFlow=1)  是的话 页面执行
	Add_navTab( 'dy_info_add','查看抵押信息','<%=path%>/project/prjprdmtg/toAddPage.do?isFlow=1&checkDy=${checkDy}&detailFlag='+detailFlag+'&dtlId='+_prjPrdDtlId+'&id='+_prjPrdDtlId, callback);
}

	function cancelPay(_capPayId){
		if(!_capPayId)return;
		
		$.ligerDialog.confirm("<span style='color: red;'>确定取消此支付表的放款吗?取消后无法恢复!</span>", function (flag) {
			if(flag == false)return;
			var wait_dialog;
			$.ajax({
				type: 'post',
				dataType:'json',
				data:{capPayId:_capPayId,processInstanceId:processInstanceId},
				url: '<%=path%>/capPay/flow/cancelPay.do',
				beforeSend: function(){
				     wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING,SQ_type:"waitting"});
				},
				success:function(msg){
					wait_dialog.close();
					 if(msg.success == 1){
						 UIUtils.alertSuccess(msg.info);
						 //grid.reload();
						 window.location.reload();
					 }else{
						 UIUtils.alertError(msg.info);
					 }
				}
			});
		});
	}

	var processInstanceId = '${proIntId}';
	var taskId = '${taskId}';
	var taskDefKey = '${taskDefKey}';
	var taskNm = '${taskNm}';
	var isAuditNode = '${isAuditNode}';
	var btnFlag = '${btnFlag}';
	var hjzxFlag = '${hjzxFlag}';
	var kjshFlag = '${kjshFlag}';
	var zjlFlag = '${zjlFlag}';
	var zjbFlag = '${zjbFlag}';
	var cnFlag = '${cnFlag}';
	var xsFlag = '${xsFlag}';
	var spFlag = '${spFlag}';
	var dyFlag = '${dyFlag}';
	var ctrlKey = '${ctrlKey}';
	var isCPCW = '${isCPCW}';
	//当前tab刷新
	function callback() {
        //window.location.reload();
        if(grid){
        	grid.reload();
        }
    }
    function toPayFlowAdditionalPage(_payId){
    	var parms = "capPayId="+_payId+"&processInstanceId="+processInstanceId+"&taskId="+taskId+"&taskDefKey="+taskDefKey+"&taskNm="+taskNm;
    		parms += "&isAuditNode="+isAuditNode+"&btnFlag="+btnFlag+"&hjzxFlag="+hjzxFlag+"&kjshFlag="+kjshFlag+"&zjlFlag="+zjlFlag;
    		parms += "&zjbFlag="+zjbFlag+"&cnFlag="+cnFlag+"&xsFlag="+xsFlag+"&spFlag="+spFlag+"&ctrlKey="+ctrlKey+"&dyFlag="+dyFlag;
    		parms += "&isCPCW="+isCPCW;
    		parms += "&checkSp=${checkSp}&checkDy=${checkDy}";
    		parms += "&isNeedCallback=1";//执行collback 刷新列表
    		parms += "&QZTX=${QZTX}";
    		parms += "&addReturnInfo=${addReturnInfo}";
    		parms += "&confirmPay=${confirmPay}";
    		parms += "&version=${version}";
    		parms += "&addReturnInfo_rebate=${addReturnInfo_rebate}";
    		parms += "&modifyRebateBank=${modifyRebateBank}";
    		parms += "&saveDueDate=${saveDueDate}";
    	var version = '${version}';	
    	if(version==3){
	    	Add_navTab('payFlowAdditionalPage'+_payId,'放款详细',"<%=path%>/capital/capPayInfo/toAddPage.do?isAddBank=${isAddBank}&accCtrl=${accCtrl}&ctrlKey=${ctrlKey}&isAddPayerStatusCd=${isAddPayerStatusCd}&id="+_payId, callback);
    	}else{
	    	Add_navTab('payFlowAdditionalPage'+_payId,'放款详细',"<%=path%>/capPay/flow/toAdditionalInfoPage.do?"+parms, callback);
    	}
    }
    //资料
    function toPrjFileInfo(){
        Add_navTab("addPrjFileInfo"+prjId, "项目资料", '<%=path%>/project/prjFileInfo/toFileInfoListPage.do?prjId='+prjId+'&ctrlKey='+ctrlKey);
    }
    
    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

    function kjhexiaoshouqi(){
    	Add_navTab("kjhexiao"+prjId, "首期款核销资金信息", '<%=path%>/capital/capFund/toAddFundPage.do?prjId='+prjId);
    }
</script>

</body>
</html>
